package com.xkdx.guangguang.sql;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class BrandSQLiteHelper extends SQLiteOpenHelper {
	public static String TAG = "SQLiteHelper";

	private int table;
	// AtoZ
	public static int ATOZTABLE = 1;
	private String TABNAME = "brand";
	public static String BRANDID = "BrandID";
	public static String BRANDNAME = "BrandName";
	public static String BRANDSIMPLENAME = "BrandSimpleName";
	public static String LOGO = "Logo";
	public static String ORDERNUM = "OrderNum";
	public static String ISDELETED = "IsDeleted";
	public static String ATOZ = "AtoZ";
	public static String BRANDTYPE = "BrandType";

	public BrandSQLiteHelper(Context context, String name, CursorFactory factory, int version, int table) {
		super(context, name, factory, version);
		this.table = table;
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		// Log.i(TAG, "onCreate");

		db.execSQL("CREATE TABLE IF NOT EXISTS " + TABNAME + "(" + BRANDID + " integer primary key," + BRANDNAME
				+ " varchar," + LOGO + " varchar," + ORDERNUM + " integer," + BRANDSIMPLENAME + " varchar," + ATOZ
				+ " varchar," + BRANDTYPE + " varchar," + ISDELETED + " varchar)");

	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// Log.i(TAG, "onUpgrade");
		db.execSQL("DROP TABLE IF EXISTS " + TABNAME);

		onCreate(db);
	}

}
